package priv.menghan.happy.learning.user.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import priv.menghan.happy.learning.common.BaseController;
import priv.menghan.happy.learning.user.req.UserInfoReq;
import priv.menghan.happy.learning.user.resp.UserInfoResp;
import priv.menghan.happy.learning.user.service.UserInfoService;

import java.util.Map;

/**
 * 用户信息 控制器
 *
 * @author Monika
 * @since 2025-06-15 01:32:21
 */
@RestController
@Tag(name = "用户信息")
@RequestMapping("user/userInfo")
public class UserInfoController extends BaseController<UserInfoReq, UserInfoResp, UserInfoService> {

	public UserInfoController(UserInfoService service) {
		super(service);
	}

	/**
	 * 登录接口
	 */
	@PostMapping("/login")
	@Operation(summary = "用户登录", description = "根据用户名和密码登录")
	public String login(@RequestBody Map<String, String> params) {
		String username = params.get("username");
		String password = params.get("password");
		if ("admin".equals(username) && "123456".equals(password)) {
			return "登录成功";
		} else {
			return "用户名或密码错误";
		}
	}

}
